const BASE_URL = "http://wechat.dishait.cn"
let userInfo = (uni.getStorageSync('user'));
export const myRequest = (options) => {
	console.log(options.url, options.method, 'myRequest')
	console.log(options, options.method)
	// options.header={}
	// options.header.Token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OTgzLCJ1c2VybmFtZSI6IndhbmdzaHVvMSIsIm5pY2tuYW1lIjoi5biD6I6x5rO9IiwiZW1haWwiOm51bGwsInBhc3N3b3JkIjoiYTY2NWE0NTkyMDQyMmY5ZDQxN2U0ODY3ZWZkYzRmYjhhMDRhMWYzZmZmMWZhMDdlOTk4ZTg2ZjdmN2EyN2FlMyIsImF2YXRhciI6IiIsInBob25lIjpudWxsLCJzZXgiOiLnlLciLCJzdGF0dXMiOjEsInNpZ24iOiIiLCJhcmVhIjoiIiwiY3JlYXRlZF9hdCI6IjIwMjQtMDMtMDNUMDY6NDk6MTIuMDAwWiIsInVwZGF0ZWRfYXQiOiIyMDI0LTAzLTA0VDAzOjMzOjExLjAwMFoiLCJpYXQiOjE3MTE0MzI5ODd9.sbjLdlgvAzucT7-IeyIlC_46FdG1XiURpWSGdd3aUeI"
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + options.url,
			method: options.method,
			data: options.data,
			header: options.header,
			success: (res) => {
				// if (res.data.code !== 200) {
				// 	return uni.showToast({
				// 		title: '获取数据失败'
				// 	})
				// }
				console.log(res)
				uni.showToast({
					title: res.data.msg
				})
				resolve(res)
			},
			fail: (err) => {
				uni.showToast({
					title: '请求接口失败'
				})
				reject(err)
			}
		})
	})
}
